﻿#ifndef TFRAMEWORK_H
#define TFRAMEWORK_H

#include "../../include/iframework.h"

class tFramework : public IFramework
{
    Q_OBJECT
public:
    static tFramework* GetInstance() {static tFramework __instance; return &__instance;}
public:
    tFramework();
    virtual ~tFramework();
    virtual int Init();
    virtual int UnInit();
    virtual int SetLogger(ILogger *pLogger);
    virtual int GetLogger(ILogger **ppLogger);
    virtual int GetCommon(ICommon **ppCommon);
    virtual int GetConfig(IConfig **ppConfig);
    virtual int GetSalesman(IService **ppSaleman);
    virtual int GetSaleswoman(IService **ppSalewoman);
    virtual int GetNetComm(INetComm **ppNetComm);
    virtual int SetCBUICommBridge(pfnUICommBridge pfn, void *pUserData);
    virtual int GetCBUICommBridge(pfnUICommBridge *ppfn, void **ppUserData);

private:
    enum __dllType
    {
        dll_min = 0,
        dll_Config,
        dll_NetComm,
        dll_Common,
        dll_max,
    };
    ILogger     *m_pLogger;
    IConfig     *m_pConfig;
    ICommon     *m_pCommon;
    INetComm    *m_pNetComm;
    IService    *m_pSalesman;
    IService    *m_pSaleswoman;

    QString     m_szLog;
    QMap<int, QLibrary*> m_mapDllInfo;
    pfnUICommBridge m_pfnCB;
    void        *m_pUserdata;
};


#endif // TFRAMEWORK_H
